include ../config.local
include $(RULESDIR)/config_comm
include ./head.rules
include $(RULESDIR)/rule.local

#DEMOSRCS    = $(wildcard *.cpp)
#DEMOSRCS    = timeeditor.cpp
#DEMOSRCS    = mycontrol.cpp
DEMOSRCS    = mycontrol_002.cpp
#DEMOSRCS    = edit.cpp

DEMOOBJS    :=  $(DEMOSRCS:%.cpp=%.o)

DEMOTARGET	:= $(TARGETDIR)/bin/mixdvr_v1

NFSTARGET := $(TTOP)/../../nfs/mixdvr_v1

DEFS = -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"mg-samples\" -DVERSION=\"3.0.12\" -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MINIGUI_COMMON_H=1 -DHAVE_DECL___NOUNIX__=0 -DHAVE_DECL__MGRM_PROCESSES=0 -D_LANG_EN=1

#applibs-y += -L$(TOPUSERLIBDIR) -llog4cplus
#applibs-y += -L$(TARGETDIR)/lib
#applibs-y += -ldswav
#applibs-y += -ldswax
#applibs-y += -ldswfontcvt
#applibs-y += -ldswparam
#applibs-y += -ldswrecoder
#applibs-y += -ldswmemory

#applibs-y += -ldswserver
#applibs-y += -ldswsession
#applibs-y += -ldswbroadcast

#applibs-y += -ldsw3gp
#applibs-y += -ldswutility

#applibs-y += -ldswlivevideo
#applibs-y += -ldswupgrade
#applibs-y += $(TOPUSERLIBDIR)/libminiupnpc.a

#applibs-y += -ldswalarmcenter

#applibs-y += -ldswmodule_gprs

#applibs-y += -ldswonvif_client
#applibs-y += -ldswextcam

#applibs-y += -lbase
#applibs-y += -ldswhashtable

#applibs-y += -levent
#applibs-y += -levent_pthreads
#applibs-y += -liconv

#applibs-y += -lonvif_client
#applibs-y += -lssl
#applibs-y += -lcrypto -lz

#applibs-y += -lavformat
#applibs-y += -lavfilter
#applibs-y += -lavcodec
#applibs-y += -lswresample
#applibs-y += -lavutil
#applibs-y += -lswscale

#applibs-y += -L$(TOPGMLIBDIR) -lgm
#applibs-y += -lmp4v2
#applibs-y += -lcurl

#applibs-y += -ldswwebs
#applibs-y += -lwebs
#applibs-y += -L$(TARGETDIR)/lib -lmarkup


applibs-y += -L$(TOP_LIB_8136_LIB)
applibs-y += -lminigui_ths
applibs-y += -ljpeg
applibs-y += -lpng
applibs-y += -lfreetype
applibs-y += -lwebs

applibs-y += -lstdc++

applibs-y += -lpthread -lm -lz

applibs-y += -ldl -lnsl -lrt -lresolv

all: $(DEMOTARGET)

include $(RULESDIR)/rule.local

$(DEMOOBJS): %.o :%.cpp
	@echo "ARCHDEF="$(ARCHDEF)
	@echo " CC $<"
	#$(CC) -c $(CFLAGS) -o $@ $<
	$(CC) -Wall -c $(CFLAGS) $(DEFS) -o $@ $<

$(DEMOTARGET):$(DEMOOBJS)
	@echo "Building Targets....."

	$(CC) $(CXXFLAGS) -Wall -o $(DEMOTARGET) $(DEMOOBJS) $(applibs-y)  
	$(STRIP) $(DEMOTARGET)
	
	#$(TARGETDIR)/upx/upx $(DEMOTARGET)

	#/bin/cp $(DEMOTARGET) $(NFSTARGET)

clean: 
	/bin/rm -f *.o $(DEMOTARGET) $(NFSTARGET)

